<template>
  <view>
    <view
      class="newTp-item"
      v-for="item in topPicList"
      :key="item.id"
      @click="gopicDetail(item)"
    >
      <image class="item-img" :src="item.titlepic" mode="widthFix"></image>
      <view class="newTP-data">
        <view class="font-md"># {{ item.title }} #</view>
        <view class="font color-gray">{{ item.desc }}</view>
        <view class="font color-gray">
          <text style="margin-right: 20rpx">动态：{{ item.post_count }}</text>
          <text>今日：{{ item.todaypost_count }}</text>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  props: ["topPicList", "title"],
  data() {
    return {};
  },
  mounted() {
    console.log(this.topPicList);
    console.log(this.title);
  },
  methods: {
    gopicDetail(data) {
      // console.log("跳转到详情页", id);
      if (this.title === "选择话题") {
        uni.$emit("selectToPic", data);

        uni.navigateBack({
          delta: 1,
        });
        // console.log();
      } else {
        uni.navigateTo({
          url:
            "/pages/topic-detail/topic-detail?data=" +
            encodeURIComponent(JSON.stringify(data)),
        });
      }
    },
  },
};
</script>
<style lang="less" scoped>
.item-img {
  width: 150rpx;
  height: 150px;
  border-radius: 8rpx;
  margin-right: 20rpx;
}
.newTp-item {
  display: flex;
  margin-top: 40rpx;
  height: 150rpx;
}
.newTP-data {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
</style>
